/*
 * LoginForm
 * 
 * Version information
 * 
 * Feb 25, 2006
 * 
 * Copyright (c) AmSoft Systems, 2006
 */
package net.amsoft.iservice.isso.webapp.struts.form;

import java.util.ResourceBundle;

import javax.servlet.http.HttpServletRequest;

import net.amsoft.iservice.isso.util.ISSOConstants;
import net.amsoft.iservice.util.IServiceUtil;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

/**
 * @author rahul
 * 
 */
@SuppressWarnings("serial")
public class LoginForm extends ActionForm {
	private String sIname;

	private String sPassword;

	private String sGlobalInumber;

	private String sSpXri;

	private boolean bRememberMachine;

	public boolean isRememberMachine() {
		return bRememberMachine;
	}

	public void setRememberMachine(boolean rememberMachine) {
		bRememberMachine = rememberMachine;
	}

	public String getPassword() {
		return sPassword;
	}

	public void setPassword(String password) {
		sPassword = password;
	}

	public String getIname() {
		return sIname;
	}

	public void setIname(String iname) {
		this.sIname = iname;
	}

	public String getGlobalInumber() {
		return sGlobalInumber;
	}

	public void setGlobalInumber(String globalInumber) {
		this.sGlobalInumber = globalInumber;
	}

	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest oRequest) {
		ActionErrors oActionErrors = new ActionErrors();
		if (sIname != null) {
			sIname = sIname.trim().toLowerCase();
			sIname = IServiceUtil.getIName(sIname);
			if (sIname != null)
				sIname = sIname.toLowerCase();
			else {
				ResourceBundle oBundle = ResourceBundle.getBundle(
						"issoResources", oRequest.getLocale());
				oActionErrors.add(ActionMessages.GLOBAL_MESSAGE,
						new ActionMessage(ISSOConstants.ERR_INVALID, oBundle
								.getString("label.useriname")));
			}
		}
		return oActionErrors;
	}

	public String getSpXri() {
		return sSpXri;
	}

	public void setSpXri(String spXri) {
		sSpXri = spXri;
	}
}
